#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2014-08-18 15:48:48
# @Author  : shitao.tommy (hero007asd@gmail.com)
# @Link    : http://example.org
# @Version : $Id$

import json

def to_json(data):
    a = json.dumps(data, ensure_ascii=True, separators=(',', ': '))
    return json.loads(a)

def to_utf8_json(data):
    a = json.JSONEncoder(ensure_ascii=False).encode(data)
    return a

def to_decode_json(data):
    a = json.JSONDecoder().decode(data)
    return a

# a = to_decode_json('{"ret":1,"start":-1,"end":-1,"country":"\u4e2d\u56fd","province":"\u4e0a\u6d77","city":"\u4e0a\u6d77","district":"","isp":"","type":"","desc":""}')
# print dir(a)
# print a['city']